﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using STLGROUP.Layers.Common;
using System.Drawing;
using System.Data.Objects.DataClasses;

namespace STLGROUP.Layers.DataAccessLayers
{
    public partial class DT_KhachHang:EntityObject
    {
        public string GioiTinhText
        {
            get
            {
                return GioiTinh.HasValue ? (GioiTinh.Value == true ? "Nam" : "Nữ") : "Nữ";
            }
        }

        public string TenDayDu
        {
            get
            {
                return HoDem + " " + Ten;
            }
        }

        public string NgaySinhText
        {
            get { return NgaySinh.HasValue ? NgaySinh.Value.ToString("dd/MM/yyyy") : string.Empty; }
        }

        public string TrangThai
        {
            get 
            {
                return this.EntityState.ToString();
            }
        }

        public Image TrackingState
        {
            get
            {
                Image img = null;
                switch (this.EntityState)
                {
                    case System.Data.EntityState.Added:
                    case System.Data.EntityState.Detached:
                        img = (Image)Properties.Resources.status_added;
                        img.Tag = STLGROUP.Layers.Common.StructsEnums.EnumEntityState.Added;
                        break;
                    case System.Data.EntityState.Deleted:
                        img = (Image)Properties.Resources.status_deleted;
                        img.Tag = STLGROUP.Layers.Common.StructsEnums.EnumEntityState.Deleted;
                        break;
                    case System.Data.EntityState.Unchanged:
                        img = (Image)Properties.Resources.status_unchanged;
                        img.Tag = STLGROUP.Layers.Common.StructsEnums.EnumEntityState.Unchanged;
                        break;
                    case System.Data.EntityState.Modified:
                        img = (Image)Properties.Resources.status_modified;
                        img.Tag = STLGROUP.Layers.Common.StructsEnums.EnumEntityState.Modified;
                        break;
                }

                return img;
            }
        }
    }
}
